<template>
  <!-- 我的邀请 -->
  <div id="active" class="active">
    <div class="activeCont" v-if='false'>
      <div class="myActiveCont_ques">
        <i class="iconfont icon-jiangli"></i>
        <span>邀请好友获取奖励</span>
      </div>
      <div class="myActiveCont_ques_ont">
        <div class="myActiveCont_ques_ont_left">1</div>
        <div class="myActiveCont_ques_ont_right">
          <p>邀请小伙伴成功注册后获得的奖励</p>
          <p>
            邀请成功后，每满10人可在平台获得
            <span>2次免费</span>检测文献机会
          </p>
        </div>
        <div style="clear:both;"></div>
      </div>
      <div class="myActiveCont_ques_two">
        <div class="myActiveCont_ques_ont_left">2</div>
        <div class="myActiveCont_ques_ont_right">
          <p>邀请小伙伴注册医药期刊联盟网账号的步骤</p>
          <p>
            <span>*</span>奖励条件：10个小伙伴点开您给他/她的邀请链接并且注册成为平台账户。
          </p>
        </div>
        <div style="clear:both;"></div>
      </div>
      <div class="myActiveCont_ques_link">
        <p>您可以发送一下邀请链接给他/她</p>
        <div class="myActiveCont_ques_link_url">
          <span>邀请链接：</span>
          <div v-if="urlpath" class="copy" @click="CopyUrl">复制链接</div>
          <el-input v-model="urlpath"></el-input>
          <div style="clear:both;"></div>
        </div>
      </div>
      <div class="myActiveCont_ques_submit" id="myActiveCont_ques_submit" @click="receimeths()">领取奖励</div>
      <p class="persorecode">*好友记录</p>
      <!-- 邀请好友记录 -->
      <div class="myActiveCont_table">
        <el-table
          :data="contB_tableData"
          style="width: 100%"
          :header-cell-style="{background:'#F8F8F8'}"
        >
          <el-table-column
            prop="Email"
            label="好友账号"
            align="center"
            header-align="center"
            min-width="100"
          ></el-table-column>
          <el-table-column
            prop="CreateTime"
            label="注册时间"
            align="center"
            header-align="center"
            min-width="100"
          ></el-table-column>
        </el-table>
      </div>
      <!-- 联系客服 -->
      <div class="myActiveCont_foot">
        <p>如有任何问题 , 请联系工作人员 : 13146223335</p>
      </div>
    </div>
	<view class="notPpen">
		暂未开通
	</view>
    
    
  </div>
</template>

<script>
// import router from "@/router/index";
//juqery
export default {
  name: "active",
  data() {
    return {
      show: false,
      ifinovres: "",
      contB_tableData: [],
      urlpath:
        "http://bjlm.bosihw.cn/register/?p=" +
        this.$localStorage.getItem("AuthorId")
    };
  },
  methods: {
    // 点击领取奖励
    receimeths() {
      if (this.ifinovres == true) {
        this.$httphelper
          .post("/api/LmPromoteApi/GetConversion", {
            Sign: "string",
            OpenId: localStorage.getItem("AuthorId")
          })
          .then(res => {
            if (res.data.data == true) {
              this.$message({
                message: "领取奖励成功",
                type: "success"
              });
              this.reload();
            } else {
              this.$message({
                message: "领取奖励失败",
                type: "warning"
              });
            }
          })
          .catch(err => {
            console.log("请求失败：" + "err");
          });
      } else {
        this.$message({
          message: "邀请人数未满十人",
          type: "success"
        });
      }
    },
    // 复制链接
    CopyUrl(data) {
      var Url2 = this.urlpath;
      var oInput = document.createElement("input");
      oInput.value = Url2;
      document.body.appendChild(oInput);
      oInput.select(); // 选择对象
      document.execCommand("Copy"); // 执行浏览器复制命令
      oInput.className = "oInput";
      oInput.style.display = "none";
      this.$message({
        message: "复制成功!",
        type: "success"
      });
    },
    // 获取邀请好友列表
    getinvomets() {
      // 加密完成
      this.$httphelper
        .post("/api/LmPromoteApi/GetPromoteRecord", {
          OpenId: localStorage.getItem("AuthorId"),
          Limit: 15,
          Page: 1
        })
        .then(res => {
          this.contB_tableData = res.data.data;
        })
        .catch(err => {
          console.log("请求失败：" + "err");
        });
    },
    // 判断用户是否符合领取奖励条件
    getifinvote() {
      this.$httphelper
        .post("/api/LmPromoteApi/GetIsSatisfy", {
          Sign: "string",
          OpenId: localStorage.getItem("AuthorId")
        })
        .then(res => {
          this.ifinovres = res.data.data;
        })
        .catch(err => {
          console.log("请求失败：" + "err");
        });
    }
  },
  created() {
    this.getinvomets();
    this.getifinvote();
  }
};
</script>

<style lang="less" scoped>
@media screen and (min-width: 1010px) {
  #active {
    display: none;
  }
}
@media screen and (max-width: 1010px) {
  #active {
    width: 100%;
    margin-bottom: 147px;
    .activeCont {
      width: 94%;
      margin: 0 auto;
      margin-top: 57px;
      .myActiveCont_ques {
        i {
          color: #003c80;
          font-size: 23px;
        }
        span {
          font-size: 15px;
          color: #000;
          font-weight: bold;
          margin-left: 9px;
          position: relative;
          top: -2px;
        }
      }
      .myActiveCont_ques_ont {
        width: 97%;
        // height: 83px;
        margin: 0 auto;
        margin-top: 17px;
        .myActiveCont_ques_ont_left {
          float: left;
          width: 24px;
          height: 24px;
          background: #af0000;
          text-align: center;
          line-height: 26px;
          border-radius: 50%;
          color: #fff;
          font-size: 16px;
        }
        .myActiveCont_ques_ont_right {
          width: 86%;
          float: right;
          margin-left: 18px;
          p:nth-child(1) {
            font-size: 16px;
            color: #000000;
            font-weight: bold;
            letter-spacing: 1px;
          }
          p:nth-child(2) {
            font-size: 14px;
            color: #000000;
            margin-top: 8px;
            letter-spacing: 1px;
            span {
              font-size: 16px;
              color: #003c80;
            }
          }
        }
      }
      .myActiveCont_ques_two {
        width: 97%;
        // height: 103px;
        margin: 0 auto;
        margin-top: 26px;
        .myActiveCont_ques_ont_left {
          float: left;
          width: 24px;
          height: 24px;
          background: #af0000;
          text-align: center;
          line-height: 26px;
          border-radius: 50%;
          color: #fff;
          font-size: 16px;
        }
        .myActiveCont_ques_ont_right {
          width: 86%;
          float: right;
          margin-left: 18px;
          p:nth-child(1) {
            font-size: 16px;
            color: #000000;
            font-weight: bold;
            letter-spacing: 1px;
          }
          p:nth-child(2) {
            font-size: 14px;
            color: #000000;
            margin-top: 8px;
            letter-spacing: 1px;
            span {
              color: #003c80;
            }
          }
        }
      }
      .myActiveCont_ques_link {
        width: 100%;
        margin: 0 auto;
        margin-top: 16px;
        // height: 173px;
        p {
          width: 70%;
          font-size: 14px;
          color: #696969;
          letter-spacing: 1px;
          margin: 0 auto;
        }
        .myActiveCont_ques_link_url {
          margin-top: 16px;
          width: 100%;
          // height: 96px;
          span {
            color: #010101;
            font-size: 16px;
            line-height: 36px;
            font-weight: bold;
            position: relative;
            top: 8px;
          }
          /deep/.el-input {
            display: block;
            width: 100%;
            margin: 16px auto;
            height: 40px;
            overflow: hidden;
            overflow-x: auto;
          }
          /deep/.el-input__inner {
            border: none;
            border: 1px solid #003c80;
            background: #e2f2fe;
          }
          .copy {
            width: 70px;
            height: 31px;
            background: #003c80;
            cursor: pointer;
            text-align: center;
            line-height: 31px;
            color: #fff;
            font-size: 14px;
            margin-top: 9px;
            float: right;
          }
        }
      }
      .myActiveCont_ques_submit {
        width: 100px;
        height: 36px;
        background: #af0000;
        font-size: 16px;
        color: #fff;
        text-align: center;
        line-height: 36px;
        cursor: pointer;
        margin: 0 auto;
        border-radius: 2px;
      }
      .persorecode {
        margin-top: 20px;
        font-size: 16px;
        color: #af0000;
        font-weight: bold;
      }
      .myActiveCont_table {
        margin-top: 26px;
      }
      .myActiveCont_foot {
        margin-top: 35px;
        p {
          color: #000;
          font-size: 14px;
          float: right;
        }
      }
    }
  }
}

.notPpen{
	height: 70vh;
	display: flex;
	justify-content: center;
	align-items: center;
	font-size: 44rpx;
}

</style>
